﻿@inherits Vowei.Web.G18nWebViewPage
@using System.Web.Mvc.Html 
              
@{
    ViewBag.Title = T("导入项目组成员");
}

<h2>@T("导入项目组成员")</h2>

<form method="post" enctype="multipart/form-data" action="/Account/ImportUsers">
    <div>
        <fieldset>
            <legend>@T("从Excel里导入项目组成员")</legend>

            <div class="editor-label">
                @T("上传Excel文件:") 
            </div>
            <div class="editor-field">
                <input type="file" name="UsersSpreadsheet" id="UsersSpreadsheet" />
            </div>       
            <div>
            @T("下载团队成员模板：")<a href="@Url.Content("~/Content/tmpl/import user template.xls")">import user template.xls</a>
            </div>
            
            @if (ViewData.ContainsKey("ProjectId"))
            {
                <input type="hidden" name="Project" id="Project" value="@ViewData["ProjectId"]" />
            }
            else
            {
                <div class="editor-label">
                    @T("隶属项目组")
                </div>
                <div class="editor-field" id="milestone_list">
                </div>
            }

            <p>
                <input type="submit" value="@T("上传")" />
            </p>
        </fieldset>
    </div>
</form>

@if ( ViewData.ContainsKey("Projects") ) 
{
    <script type="text/html" id="milestone_tmpl">	
        <select name="Project" id="Project">
            {{each dataContext}}
            <option value="${ID}">${Title}</option>
            {{/each}}
        </select>
    </script>
    
    <script language="javascript" type="text/javascript">
        @{  
    var projectsText = new HtmlString((string)ViewData["Projects"]);        
        }

        // 添加milestone 列表的支持
        var milestones = @projectsText;
        $('#milestone_tmpl').tmpl({ dataContext: milestones }).appendTo('#milestone_list');    
    </script>
}